package com.zry.traced.ui.activity

import com.zry.traced.R
import com.zry.traced.been.StoreOrderBean
import com.zry.traced.databinding.ActivityPutStorageBinding
import com.zry.traced.presenter.PutStoragePresenter
import com.zry.traced.ui.base.BaseActivity
import kotlinx.android.synthetic.main.activity_put_storage.*
import kotlinx.android.synthetic.main.common_title.*

class PutStorageActivity : BaseActivity() {
    private var putStorageBinding: ActivityPutStorageBinding? = null
    var storeOrderBean: StoreOrderBean? = null
    private var putStoragePresenter: PutStoragePresenter? = null
    private var title = ""
    override fun getLayoutId(): Int {
        return R.layout.activity_put_storage
    }

    override fun initData() {
        title = intent.getStringExtra("title")
        storeOrderBean = intent.getSerializableExtra("StoreOrderBean") as StoreOrderBean
        titleCenterText.text = title
        commonLeftLinearLayout.setOnClickListener { finish() }

        putStorageBinding = viewDataBinding as ActivityPutStorageBinding
        putStoragePresenter = PutStoragePresenter(this)
        putStorageBinding?.handlerClick = putStoragePresenter
        putStorageBinding?.storeOrderBean = storeOrderBean


        initView()
    }

    private fun initView() {
        when (storeOrderBean?.StoreType) {
            "1" -> putStorageMethodTV.text = "单品入库"
            "2" -> putStorageMethodTV.text = "二级码入库"
            "3" -> putStorageMethodTV.text = "三级码入库"
        }
        when (storeOrderBean?.StateID) {
            "1" -> putStorageTypeTV.text = "手动入库"
            "2" -> putStorageTypeTV.text = "自动入库"
        }
    }

}
